package com.feicheng.common.advice;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;

import com.feicheng.common.token.TokenContainer;

import lombok.extern.slf4j.Slf4j;

@Aspect
@Slf4j
public class TokenAspect {

    @Pointcut(value = "execution(* com.feicheng.controller..*.*(..))")
    public void webLog(){}

    @Before(value = "webLog()")
    public void doBefore(JoinPoint joinPoint) {
    }

    @Around(value = "webLog()")
    public Object doAround(ProceedingJoinPoint thisJoinPoint) throws Throwable {
        Object result = thisJoinPoint.proceed();
        TokenContainer.removeCurrentTokenId();
        return result;
    }

}
